<template>
  <div>检查申请</div>
  <CheckRequestTableView ref="checkRequestTableView"></CheckRequestTableView>
  <div>医嘱</div>
  <el-form
      label-position="right"
      label-width="100px"
      :model="checkRequest"
      style="max-width: 460px">
    <el-form-item label="医生写给检查医师的信息">
      <el-input v-model="checkRequest.checkInfo"/>
    </el-form-item>
    <el-form-item label="检查身体位置">
      <el-input v-model="checkRequest.checkPosition"/>
    </el-form-item>
    <el-form-item>
      <el-button
          type="primary"
          @click="onSubmit">
        申请提交
      </el-button>
      <el-button
          @click="onReset">
        清空
      </el-button>
    </el-form-item>
  </el-form>
</template>

<script>
import axios from 'axios'
import CheckRequestTableView from "@/views/CheckRequestTableView";

export default {
  name: "CheckRequestView",
  components: {CheckRequestTableView},
  data() {
    return {
      checkRequest: {
        registerId: this.$store.state.currentPatient.id,
        checkInfo: "医生写给检查医师的信息",
        checkPosition: "检查位置"
      }
    }
  },
  methods: {
    onSubmit() {
      this.checkRequest.technologies = this.$refs.checkRequestTableView.medicalTechList

      axios({
        url: '/api/check_request/add',
        method: 'post',
        data: this.checkRequest
      }).then(res => {
        this.$router.push("/home/physician-patient")
      }).catch(err => {
      }).then(() => {
      })
    },
    onReset() {
      this.checkReqeust.checkInfo = '';
      this.checkReqeust.checkPosition = '';
    }
  }
}
</script>

<style scoped>

</style>